-
Notifications
You must be signed in to change notification settings - Fork 175
Bug/694 circuit relay stream hangs indefinite #767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Bug/694 circuit relay stream hangs indefinite #767
Conversation
…://github.com/Winter-Soren/py-libp2p into bug/694-circuit-relay-stream-hangs-indefinite
@Winter-Soren : Hi Soham. Thank you for submitting the PR. Appreciate it. Wish if you could fix the CI/CD issues. Circuit relay is indeed urgently needed for universal connectivity dapp for py-libp2p and also for the workshop branch. |
@guha-rahul , @sukhman-sukh, @lla-dane : Wish if you could test circuit relay on your devices in parallel. |
@Winter-Soren : Great, thanks Soham. Please add test cases covering specific NAT traversal scenarios and add a newsfragment. Will do a final review + merge after we do a collective testing. Appreciate your efforts. |
Hi @lla-dane and @guha-rahul, I’d love to get your review on the example. Would appreciate it if you could take a fresh look and suggest any improvements. |
Hey @Winter-Soren, luca made some more fixes on yamux. Can you rebase it and test again. Maybe that could fir the issue |
At my end, it is failing when the source peer is attempting to dial destination:
![]() |
I am getting the same error as @lla-dane , but a quick question, should we be sending out raw protobuf messages since in other places I saw we are using variants. |
@guha-rahul : Thanks for raising this—and great question! You're right to observe the difference here. In some parts of the codebase, especially when interfacing with protocols like Identify or PeerRecord, we use protobuf variants or length-prefixed wrappers to ensure compatibility with libp2p's framing expectations. However, in other cases—especially when we're doing low-level testing or working within a tightly scoped context—we send raw protobuf messages directly over the stream. In the specific scenario you’re encountering (same as @lla-dane’s), it's expected to send raw protobuf messages unless the protocol explicitly requires a variant or length-prefix for parsing. If you're getting an error, it might be related to how the message is being framed or interpreted on the receiving end. Feel free to share a snippet or the stack trace—happy to ask @Winter-Soren, @sukhman-sukh and @lla-dane help debug further. We’re working towards clearer abstractions for these different framing cases to avoid this confusion going forward. Appreciate your attention to detail. |
@Winter-Soren I have tried running the code and found some issues:
We are currently unable to access the actual debug logs of the circuit relays.
In the setup destination function we use:
and after that we start it as a background service.
which immediately starts searching for relay servers:
But at that time there are no hosts connected as:
The host connection is done in the last line. So, in summary, the typical sequence is as follows: Proposed Solution:
This solution may not fully resolve all of the existing issues; however, it may represents a significant step forward toward addressing the problem. what's your thoughts on this @Winter-Soren |
@Winter-Soren : Thank you for making improvements. Appreciate it. Please resolve the CI/CD issues. |
Hey @Winter-Soren @seetadev, I have fixed reservation and hop/stop connection through relay in this PR Winter-Soren#1. I have created merge request to this ongoing PR. Please review and merge |
Also, I have a few doubts, like:
is failing if no message is immediately sent on the stream but I think it should wait till connection closes and not end after 2/3 tries which are meant to fail if other side is not sending anything. |
What was wrong?
The execution of the circuit-relay example hangs indefinitely when attempting to create a new stream on a successfully established relay connection. The code connects to the relay node and establishes a connection to the destination through the relay, but then freezes when trying to open a stream on that connection without any error messages or exceptions being thrown.
Issue #694
How was it fixed?
Loggers were added to aid debugging. The indefinite hanging issue has been resolved, but now the execution halts when the CONNECT message is sent.
Summary of approach.
To-Do
Cute Animal Picture